package main

func distributeCandies(candies int, num_people int) []int {
	result := make([]int, num_people)
	current := 1
	i := 0
	for candies > 0 {
		if current <= candies {
			result[i] += current
		} else {
			result[i] += candies
			break
		}
		candies -= current
		current++
		if i == num_people-1 {
			i = 0
		} else {
			i++
		}
	}
	return result
}

func main() {
	v := distributeCandies(10, 3)
	println(v)
}
